package com.example.mykotlin.model.entity

import com.example.mykotlin.base.valid.Insert
import com.fasterxml.jackson.annotation.JsonFormat
import com.mybatisflex.annotation.Id
import io.swagger.v3.oas.annotations.media.Schema
import jakarta.validation.constraints.NotBlank
import jakarta.validation.constraints.NotNull
import jakarta.validation.constraints.Size
import java.time.LocalDateTime

@Schema(name = "Role", title = "角色表")
open class Role(
    @Schema(title = "角色的唯一标识符")
    @Id
    @field:Size(max = 64, message = "长度不能超过64")
    @field:NotBlank(message = "不能为空")
    var id: String? = null,

    @Schema(title = "角色的名称，必须是唯一的")
    @field:Size(max = 128, message = "长度不能超过128")
    @field:NotBlank(message = "不能为空", groups = [Insert::class])
    var name: String? = null,

    @Schema(title = "角色的详细描述或功能说明")
    @field:Size(max = 256, message = "长度不能超过256")
    var description: String? = null,

    @Schema(title = "记录创建的时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @field:NotNull(message = "不能为空", groups = [Insert::class])
    var createTime: LocalDateTime? = null,

    @Schema(title = "记录最后更新的时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @field:NotNull(message = "不能为空", groups = [Insert::class])
    var updateTime: LocalDateTime? = null
)